/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package klijent.gui.util;

import domen.Vezbac;
import java.util.LinkedList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Ivan Ivic
 */
public class ModelTabeleVezbaci extends AbstractTableModel {
    private LinkedList<Vezbac> listaVezbaca;
    private String[] naziviKolona = {"Clanski broj", "Ime", "Prezime"};

    public ModelTabeleVezbaci() {
        listaVezbaca = new LinkedList<Vezbac>();
    }

    public ModelTabeleVezbaci(LinkedList<Vezbac> listaVezbaca) {
        this.listaVezbaca = listaVezbaca;
    }

    public int getRowCount() {
        return listaVezbaca.size();
    }

    public int getColumnCount() {
        return 3;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        switch(columnIndex)
        {
            case 0:
                return listaVezbaca.get(rowIndex).getVezbacID();
            case 1:
                return listaVezbaca.get(rowIndex).getIme();
            case 2:
                return listaVezbaca.get(rowIndex).getPrezime();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        return naziviKolona[column];
    }
}
